#include "xEngineConfig.h"





namespace XE
{


	xEngineConfig::xEngineConfig(const xString& fileName)
		:xFileParse(fileName)
	{


		AddAttributeParseFun("Renderfile",static_cast<ParseAttributeFun>(&xEngineConfig::ParserRenderAttribute));
		AddAttributeParseFun("Path",static_cast<ParseAttributeFun>(&xEngineConfig::ParserPathList));
		AddAttributeParseFun("PlugName",static_cast<ParseAttributeFun>(&xEngineConfig::ParserPlugList));


	}

	void xEngineConfig::\
		ParserRenderAttribute(const xString& element,const xString& Attribute,const xString& Value)
	{

		m_RenderPlug = Value;

	}

	void xEngineConfig::\
		ParserPathList(const xString& element,const xString& Attribute,const xString& Value)
	{
		 xEngineResourcePath::iterator it = m_PathList.find(element);
		 if(it==m_PathList.end())
		 {
			xStringVector pathlist;
			pathlist.push_back(Value);
			m_PathList.insert(std::make_pair(element,pathlist));
		 }else
		 {
			 it->second.push_back(Value);
		 }
		 return ;


	}


	void  xEngineConfig::ParserPlugList(const xString& element,const xString& Attribute,const xString& value)
	{
		m_PlugList.insert(std::make_pair(element,value));
		return ;
	}


	const xStringVector*
		 xEngineConfig::GetResourceList(const xString& ResourceType) const 
	{

		xEngineResourcePath::const_iterator it = m_PathList.find(ResourceType);
		if(it==m_PathList.end())
			return NULL;
		return &(it->second);
	}


}